package game;

import java.awt.Graphics2D;
import java.awt.event.KeyEvent;

class SceneManager
{
    static private SCENE currentScene;
    static public Scene scene = null;
    static private boolean escapePressed;

	static public void Setup()
	{
		SceneManager.scene = new MatrixType();
		SceneManager.currentScene = SCENE.SCN_MATRIX_TYPE;
	}

	static public void ChangeScene()
	{
		switch (currentScene)
		{
			case SCN_MATRIX_TYPE:
				SceneManager.scene = new MatrixOperation();
				SceneManager.currentScene = SCENE.SCN_MATRIX_OPERATION;
				break;
				
			case SCN_MATRIX_OPERATION:
				SceneManager.scene = new Calculator();
				SceneManager.currentScene = SCENE.SCN_CALCULATOR;
				break;
		}
	}
	
	static public void GoBack()
	{
		switch (currentScene)
		{
			case SCN_MATRIX_OPERATION:
				SceneManager.scene = new MatrixType();
				SceneManager.currentScene = SCENE.SCN_MATRIX_TYPE;
				break;
			case SCN_CALCULATOR:
				SceneManager.scene = new MatrixOperation();
				SceneManager.currentScene = SCENE.SCN_MATRIX_OPERATION;
				break;	
		}
	}
	
	static public void update()
	{
		SceneManager.scene.update();
		GerParticula.getInstance().update();
		
		if (Keyboard.getInstance().isKeyPressed(KeyEvent.VK_ESCAPE))
		{
			if(escapePressed == false)
			{
				escapePressed = true;
				GoBack();
			}
		}
		else
			escapePressed = false;
			
	}
	
	static public void draw(Graphics2D g2d)
	{
		SceneManager.scene.draw(g2d);
		GerParticula.getInstance().draw(g2d);
	}

	enum SCENE
	{
		SCN_MATRIX_TYPE,
		SCN_MATRIX_OPERATION,
		SCN_CALCULATOR,
	}
}